﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace MyVideoViewerLibrary
{
    public delegate void GetFilesEvent(Movie movie);
    public class Movie : INotifyPropertyChanged
    {
        private bool watched;

        public string Title { get; set; }
        public string SortTitle { get; set; }
        public int Runtime { get; set; }       
        public decimal? Rating { get; set; }
        public string MPAARating { get; set; }
        public string MPAARatingDescription { get; set; }
        public string Description { get; set; }        
        //public string MovieDirectory { get; set; }
        public string PosterImageLocation { get; set; }
        public string BackgroundImageLocation { get; set; }
        public DateTime? ReleaseDate { get; set; }
        public DateTime? DateAdded { get; set; }       
        public string Director { get; set; }
        public string IMDBId { get; set; }
        public string Trailer { get; set; }
        public bool Watched
        {
            get { return watched; }
            set
            {
                watched = value;
                if (PropertyChanged != null)
                    PropertyChanged(this, new PropertyChangedEventArgs("Watched"));
            }
        }

        public object Data { get; set; }

        public List<Genre> Genres { get; set; }
        public List<Studio> Studios { get; set; }
        public List<CastMember> Cast { get; set; }
        public List<string> Files { get; set; }

        public event GetFilesEvent OnGetFiles;

        public Movie()
        {
            Genres = new List<Genre>();
            Studios = new List<Studio>();
            Cast = new List<CastMember>();
            Files = new List<string>();
        }

        public void GetFiles()
        {
            if (Files.Count > 0)
                return;
            if (OnGetFiles != null)
                OnGetFiles(this);
        }

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;

        #endregion
    }
}
